package com.tamo.ppresta.fragment;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.PopupWindow;
import android.widget.RelativeLayout;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.cardview.widget.CardView;
import androidx.core.widget.NestedScrollView;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.listener.OnItemClickListener;
import com.gyf.immersionbar.BarHide;
import com.gyf.immersionbar.ImmersionBar;
import com.hjq.http.EasyHttp;
import com.hjq.http.body.JsonBody;
import com.hjq.http.listener.OnHttpListener;
import com.hjq.http.request.PostRequest;
import com.scwang.smart.refresh.footer.BallPulseFooter;
import com.scwang.smart.refresh.footer.ClassicsFooter;
import com.scwang.smart.refresh.header.ClassicsHeader;
import com.scwang.smart.refresh.header.MaterialHeader;
import com.scwang.smart.refresh.layout.SmartRefreshLayout;
import com.scwang.smart.refresh.layout.api.RefreshLayout;
import com.scwang.smart.refresh.layout.constant.SpinnerStyle;
import com.scwang.smart.refresh.layout.listener.OnLoadMoreListener;
import com.scwang.smart.refresh.layout.listener.OnRefreshListener;
import com.tamo.ppresta.R;
import com.tamo.ppresta.activity.AuditActvity;
import com.tamo.ppresta.activity.ProductoDetailActivity;
import com.tamo.ppresta.adapter.HomeAdapter;
import com.tamo.ppresta.base.BaseApplication;
import com.tamo.ppresta.bean.GetMineInfoBean;
import com.tamo.ppresta.bean.GetRecommendItemsBean;
import com.tamo.ppresta.bean.GetReconmmendAppsBean;
import com.tamo.ppresta.constant.APP_CONSTANT;
import com.tamo.ppresta.constant.NET_CONSTANT;
import com.tamo.ppresta.constant.SPConstant;
import com.tamo.ppresta.greendao.DBManager;
import com.tamo.ppresta.http.HttpData;
import com.tamo.ppresta.httpapi.GetMineInfoApi;
import com.tamo.ppresta.httpapi.GetRecommendAppsApi;
import com.tamo.ppresta.httpapi.GetRecommendItemsApi;
import com.tamo.ppresta.json.ObjectToJsonUtil;
import com.tamo.ppresta.util.AESUtils;
import com.tamo.ppresta.util.ButtonUtils;
import com.tamo.ppresta.util.LogUtils;
import com.tamo.ppresta.util.MapUtils;
import com.tamo.ppresta.util.MyUtils;
import com.tamo.ppresta.util.SPUtil;
import com.tamo.ppresta.util.ThirdApp;
import com.tamo.ppresta.util.ToastUtil;

import org.jetbrains.annotations.NotNull;

import java.util.ArrayList;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import okhttp3.Call;


/**
 * A simple {@link Fragment} subclass.
 * Use the {@link HomeFragment#newInstance} factory method to
 * create an instance of this fragment.
 */
public class HomeFragment extends Fragment {
    private static String TAG = HomeFragment.class.getSimpleName();

    // TODO: Rename parameter arguments, choose names that match
    // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
    private static final String ARG_PARAM1 = "param1";
    private static final String ARG_PARAM2 = "param2";
    @BindView(R.id.refresh_header)
    ClassicsHeader mRefreshHeader;
    @BindView(R.id.recyclerView)
    RecyclerView mRecyclerView;
    @BindView(R.id.refresh_footer)
    ClassicsFooter mRefreshFooter;
    @BindView(R.id.refreshLayout)
    SmartRefreshLayout mRefreshLayout;
    @BindView(R.id.iv_shouye_banner)
    ImageView mIvShouyeBanner;
    @BindView(R.id.iv_shouye_kefu)
    ImageView mIvShouyeKefu;
    @BindView(R.id.rl_shouye_kefu)
    RelativeLayout mRlShouyeKefu;
    @BindView(R.id.rl_content)
    RelativeLayout mRlContent;
    @BindView(R.id.tv_jinqian)
    TextView mTvJinqian;
    @BindView(R.id.tv_jine)
    TextView mTvJine;
    @BindView(R.id.rl_jine)
    RelativeLayout mRlJine;
    @BindView(R.id.iv_clock)
    ImageView mIvClock;
    @BindView(R.id.tv_clock)
    TextView mTvClock;
    @BindView(R.id.rl_clock)
    RelativeLayout mRlClock;
    @BindView(R.id.iv_jinbi)
    ImageView mIvJinbi;
    @BindView(R.id.tv_daikuanjine)
    TextView mTvDaikuanjine;
    @BindView(R.id.rl_jinbi)
    RelativeLayout mRlJinbi;
    @BindView(R.id.cv_1)
    CardView mCv1;
    @BindView(R.id.iv_buzhou)
    ImageView mIvBuzhou;
    @BindView(R.id.tv_buzhou)
    TextView mTvBuzhou;
    @BindView(R.id.cv_2)
    CardView mCv2;
    @BindView(R.id.nsv_no_data)
    NestedScrollView mNsvNoData;

    // TODO: Rename and change types of parameters
    private String mParam1;
    private String mParam2;

    private Unbinder unbinder;
    private PopupWindow mPopupWindow;
    private String mSesscionId;
    private int mPageNumber = 1;
    private ArrayList<GetRecommendItemsBean.RecommendItemsEntity> mRecommendItems;
    private ArrayList<GetReconmmendAppsBean.RecommendAppListEntity> mRecommendAppListEntities;
    private HomeAdapter mHomeAdapter;

    public HomeFragment() {
        // Required empty public constructor
    }

    /**
     * Use this factory method to create a new instance of
     * this fragment using the provided parameters.
     *
     * @param param1 Parameter 1.
     * @param param2 Parameter 2.
     * @return A new instance of fragment HomeFragment.
     */
    // TODO: Rename and change types and number of parameters
    public static HomeFragment newInstance(String param1, String param2) {
        HomeFragment fragment = new HomeFragment();
        Bundle args = new Bundle();
        args.putString(ARG_PARAM1, param1);
        args.putString(ARG_PARAM2, param2);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mParam1 = getArguments().getString(ARG_PARAM1);
            mParam2 = getArguments().getString(ARG_PARAM2);
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        View view = inflater.inflate(R.layout.fragment_home, container, false);
        //返回一个unbinder对象，
        unbinder = ButterKnife.bind(this, view);
        setStatusBar();
        return view;
    }

    private void setStatusBar() {
        MyUtils.setStatusBarVisible(getActivity());
        ImmersionBar.with(getActivity())
                .fitsSystemWindows(true)
                .transparentStatusBar()
                .statusBarColor(R.color.color_6981f1)
                .statusBarDarkFont(false)
                .hideBar(BarHide.FLAG_HIDE_NAVIGATION_BAR)
                .keyboardEnable(true)
                .init();
    }

    @Override
    public void onActivityCreated(@Nullable @org.jetbrains.annotations.Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);

        //设置 Header 为 贝塞尔雷达 样式
//        mRefreshLayout.setRefreshHeader(new BezierRadarHeader(getContext()).setEnableHorizontalDrag(true));
//        mRefreshLayout.setRefreshHeader(new MaterialHeader(context).setColorSchemeResources(R.color.colorRed,R.color.colorGreen,R.color.colorBlue);
        mRefreshLayout.setRefreshHeader(new MaterialHeader(getContext()).setColorSchemeResources(R.color.colorRed, R.color.colorGreen, R.color.colorBlue));
        //设置 Footer 为 球脉冲 样式
        mRefreshLayout.setRefreshFooter(new BallPulseFooter(getContext()).setSpinnerStyle(SpinnerStyle.Scale));

        mRefreshLayout.setOnRefreshListener(new OnRefreshListener() {
            @Override
            public void onRefresh(RefreshLayout refreshlayout) {
                mPageNumber = 1;
                getHomeApi(mSesscionId, mPageNumber);
            }
        });
        mRefreshLayout.setOnLoadMoreListener(new OnLoadMoreListener() {
            @Override
            public void onLoadMore(RefreshLayout refreshlayout) {
                if (mRecommendItems != null && mRecommendItems.size() >= (Integer.valueOf(NET_CONSTANT.PAGE_SIZE) * mPageNumber)) {
                    mPageNumber++;
                    getHomeApi(mSesscionId, mPageNumber);
                } else {
                    refreshlayout.finishLoadMore(2000/*,false*/);//传入false表示加载失败
                }
            }
        });
        mRlShouyeKefu.setOnClickListener(this::onClick);
        mCv1.setOnClickListener(this::onClick);
        mCv2.setOnClickListener(this::onClick);
    }

    private void onClick(View view) {
        ButtonUtils.isFastDoubleClick();
        switch (view.getId()) {
            case R.id.rl_shouye_kefu:
                showKeFuPopWindow();
                break;
            case R.id.cv_1:
                ToastUtil.showShort(getActivity(), "点击item1");
                break;
            case R.id.cv_2:
                ToastUtil.showShort(getActivity(), "点击item2");
                break;
        }
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        //进行判空，避免空指针
        if (unbinder != null) {
            unbinder.unbind();
        }
    }

    /**
     * 展示客服弹窗
     */
    private void showKeFuPopWindow() {
        // 1、获取用于 PopupWindow 的弹窗view
        LayoutInflater layoutInflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View customView = layoutInflater.inflate(R.layout.pop_kefutankuang, null);
        View layout = layoutInflater.inflate(R.layout.activity_main, null);

        // 2、创建 PopupWindow 实例，传入 View 及宽高
        mPopupWindow = new PopupWindow(customView, RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
        mPopupWindow.setOutsideTouchable(false);

        // 3、展示
        mPopupWindow.showAtLocation(layout, Gravity.CENTER, 0, 0);
        MyUtils.backgroundAlpha(getActivity(), 0.5f);


        customView.findViewById(R.id.rl_kefutankuang_close).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mPopupWindow.dismiss();
                MyUtils.backgroundAlpha(getActivity(), 1f);
            }
        });
        TextView tvPhone1 = customView.findViewById(R.id.tv_phone_number1);
        TextView tvPhone2 = customView.findViewById(R.id.tv_phone_number2);
        customView.findViewById(R.id.iv_wechat1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ThirdApp.chatInWhatsApp(getActivity(), tvPhone1.getText().toString());
            }
        });
        customView.findViewById(R.id.iv_phone1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ThirdApp.callPhone(getActivity(), tvPhone1.getText().toString());
            }
        });
        customView.findViewById(R.id.iv_wechat2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ThirdApp.chatInWhatsApp(getActivity(), tvPhone2.getText().toString());
            }
        });
        customView.findViewById(R.id.iv_phone2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ThirdApp.callPhone(getActivity(), tvPhone1.getText().toString());
            }
        });
    }

    public boolean getPopupWindowShow() {
        if (null != mPopupWindow) {
            return mPopupWindow.isShowing();
        } else {
            return false;
        }
    }

    @Override
    public void onResume() {
        super.onResume();

        mSesscionId = SPUtil.getString(getContext(), SPConstant.SP_NAME, SPConstant.SP_SESSIONID);
        if (!mSesscionId.isEmpty()) {
            mRefreshLayout.setVisibility(View.VISIBLE);
            mNsvNoData.setVisibility(View.GONE);
            getHomeApi(mSesscionId, mPageNumber);
        } else {
            mRefreshLayout.setVisibility(View.GONE);
            mNsvNoData.setVisibility(View.VISIBLE);
            // TODO: 2022/12/26 展示默认布局 特殊账户
        }

    }

    /**
     * 获取首页可以贷款列表
     *
     * @param sesscionId
     * @param pageNumber
     */
    private void getHomeApi(String sesscionId, int pageNumber) {
        String privateKey = AESUtils.getPrivateKey(24);
        String privateKeyFront = AESUtils.getPrivateKeyFront(privateKey);
        String privateKeyBehind = AESUtils.getPrivateKeyBehind(privateKey);
        LogUtils.info(TAG, "随机秘钥：" + privateKey);
        LogUtils.info(TAG, "随机秘钥19：" + privateKeyFront);
        LogUtils.info(TAG, "随机秘钥5：" + privateKeyBehind);
        BaseApplication.getInstance().setEasyHttpHead(NET_CONSTANT.HEADER_SECRETKEY_NAME, privateKeyFront);
        GetRecommendItemsApi getRecommendItemsApi = new GetRecommendItemsApi().setLanguageCode(NET_CONSTANT.LANGUAGE_CODE)
                .setItemCode(NET_CONSTANT.ITEM_CODE)
                .setSessionId(sesscionId)
                .setPageSize(NET_CONSTANT.PAGE_SIZE)
                .setPageNumber(String.valueOf(pageNumber));

        Map<String, Object> stringObjectMap = MapUtils.objectToMap(getRecommendItemsApi);
        String json = ObjectToJsonUtil.getJson(stringObjectMap);
        LogUtils.info(TAG, json);
        String newJson = ObjectToJsonUtil.getNewJson(stringObjectMap);
        LogUtils.info(TAG, newJson);
        String aesEncrypt = AESUtils.aesEncrypt(newJson, privateKey, NET_CONSTANT.VIPARR);
        LogUtils.info(TAG, "加密： " + aesEncrypt);
        String aesDecrypt = AESUtils.aesDecrypt(aesEncrypt, privateKey, NET_CONSTANT.VIPARR);
        LogUtils.info(TAG, "解密： " + aesDecrypt);
        JsonBody jsonBody = new JsonBody(aesEncrypt + privateKeyBehind);
        PostRequest post = EasyHttp.post(this);
        post.api(new GetRecommendItemsApi());
        post.body(jsonBody);
        post.request(new OnHttpListener<HttpData<GetRecommendItemsBean>>() {

            @Override
            public void onSucceed(HttpData<GetRecommendItemsBean> result) {
                LogUtils.info(TAG, "onSucceed: " + result.toString());
                getRecommendApps(mSesscionId, mPageNumber);
                //// TODO: 2022/12/31 getMineInfo() 
                if (null != result) {
                    if (null != result.getData()) {
                        if (null != result.getData().getRecommendItems()) {
                            if (null == mRecommendItems) {
                                mRecommendItems = new ArrayList<GetRecommendItemsBean.RecommendItemsEntity>();
                            } else {
                                mRecommendItems.clear();
                            }
                            mRecommendItems.addAll(result.getData().getRecommendItems());
                            if (!result.getData().getRecommendItems().get(0).getProductItemCode().isEmpty()) {
                                getMineInfo(result.getData().getRecommendItems().get(0).getProductItemCode());
                            }
                            if (mHomeAdapter == null) {
                                mHomeAdapter = new HomeAdapter(R.layout.layout_item_home, mRecommendItems);
                            } else {
                                mHomeAdapter.setRecommendItemsEntity(mRecommendItems);
                            }
                            mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
                            if (mHomeAdapter.hasFooterLayout()) {
                                mHomeAdapter.removeAllFooterView();
                            }
                            mRecyclerView.setAdapter(mHomeAdapter);
                            mHomeAdapter.setOnItemClickListener(new OnItemClickListener() {
                                @Override
                                public void onItemClick(@NonNull @NotNull BaseQuickAdapter<?, ?> adapter, @NonNull @NotNull View view, int position) {
                                    LogUtils.info(TAG, mHomeAdapter.getRecommendItemsEntity().get(position).toString());
                                    Intent intent = new Intent();
                                    switch (mHomeAdapter.getRecommendItemsEntity().get(position).getUserStatus()) {
                                        case 0:
                                        case 1:
                                        case 9:
                                            intent.setClass(getActivity(), ProductoDetailActivity.class);
                                            break;
                                        case 2:
                                        case 3:
                                        case 4:
                                        case 5:
                                        case 6:
                                            intent.setClass(getActivity(), AuditActvity.class);
                                            break;
                                        case 7:
                                        case 8:
                                        case 10:
//                                            tvItemState.setText("去还款");
//                                            tvItemState.setBackground(R.drawable.bottom_red_bg);
                                            break;
                                    }
                                    Bundle bundle = new Bundle();
                                    bundle.putSerializable(APP_CONSTANT.DATA, mHomeAdapter.getRecommendItemsEntity().get(position));
                                    intent.putExtras(bundle);
                                    getActivity().startActivity(intent);
                                }
                            });
                        }
                    }
                }
            }

            @Override
            public void onFail(Exception e) {
                LogUtils.info(TAG, "onFail: " + e.toString());
            }

            @Override
            public void onEnd(Call call) {
                mRefreshLayout.finishRefresh();
                mRefreshLayout.finishLoadMore();
            }
        });
    }

    private void getRecommendApps(String sesscionId, int pageNumber) {
        String privateKey = AESUtils.getPrivateKey(24);
        String privateKeyFront = AESUtils.getPrivateKeyFront(privateKey);
        String privateKeyBehind = AESUtils.getPrivateKeyBehind(privateKey);
        LogUtils.info(TAG, "随机秘钥：" + privateKey);
        LogUtils.info(TAG, "随机秘钥19：" + privateKeyFront);
        LogUtils.info(TAG, "随机秘钥5：" + privateKeyBehind);
        BaseApplication.getInstance().setEasyHttpHead(NET_CONSTANT.HEADER_SECRETKEY_NAME, privateKeyFront);
        GetRecommendAppsApi getRecommendAppsApi = new GetRecommendAppsApi().setLanguageCode(NET_CONSTANT.LANGUAGE_CODE)
                .setItemCode(NET_CONSTANT.ITEM_CODE)
                .setSessionId(sesscionId)
                .setLanguageCode(NET_CONSTANT.LANGUAGE_CODE)
                .setProductItemCode(NET_CONSTANT.PRODUCTITEM_CODE)
                .setPageTypeCode(NET_CONSTANT.PAGE_TYPE_CODE)
                .setPageSize(NET_CONSTANT.PAGE_SIZE)
                .setPageNumber(String.valueOf(pageNumber));

        Map<String, Object> stringObjectMap = MapUtils.objectToMap(getRecommendAppsApi);
        String json = ObjectToJsonUtil.getJson(stringObjectMap);
        LogUtils.info(TAG, json);
        String newJson = ObjectToJsonUtil.getNewJson(stringObjectMap);
        LogUtils.info(TAG, newJson);
        String aesEncrypt = AESUtils.aesEncrypt(newJson, privateKey, NET_CONSTANT.VIPARR);
        LogUtils.info(TAG, "加密： " + aesEncrypt);
        String aesDecrypt = AESUtils.aesDecrypt(aesEncrypt, privateKey, NET_CONSTANT.VIPARR);
        LogUtils.info(TAG, "解密： " + aesDecrypt);
        JsonBody jsonBody = new JsonBody(aesEncrypt + privateKeyBehind);
        EasyHttp.post(this).api(new GetRecommendAppsApi()).body(jsonBody).request(new OnHttpListener<HttpData<GetReconmmendAppsBean>>() {

            @Override
            public void onSucceed(HttpData<GetReconmmendAppsBean> result) {
                LogUtils.info(TAG, "onSucceed: " + result.toString());
                if (result != null) {
                    if (result.getData() != null) {
                        if (result.getData().getRecommendAppList() != null && result.getData().getRecommendAppList().size() != 0) {
//                            mHomeAdapter.addFooterView(getView());
                            if (mRecommendAppListEntities == null) {
                                mRecommendAppListEntities = new ArrayList<>();
                            } else {
                                mRecommendAppListEntities.clear();
                            }
                            mRecommendAppListEntities.addAll(result.getData().getRecommendAppList());
                            mHomeAdapter.setApps(true, mRecommendAppListEntities);
                        } else {
                            //不添加尾部布局
                            // TODO: 2022/12/31 测试用
                            View inflate = LayoutInflater.from(getActivity()).inflate(R.layout.layout_item_home_app, null);
                            View inflate1 = LayoutInflater.from(getActivity()).inflate(R.layout.layout_cut_off, null);
                            View inflate2 = LayoutInflater.from(getActivity()).inflate(R.layout.layout_empty, null);
                            if (mHomeAdapter.hasFooterLayout()) {
                                mHomeAdapter.removeAllFooterView();
                            }
                            mHomeAdapter.addFooterView(inflate1);
                            mHomeAdapter.addFooterView(inflate2);
                            mHomeAdapter.addFooterView(inflate);
                            inflate.setOnClickListener(new View.OnClickListener() {
                                @Override
                                public void onClick(View v) {
                                    LogUtils.info(TAG, "点击了推荐布局");
                                }
                            });
                        }
                    }
                }
            }

            @Override
            public void onFail(Exception e) {
                LogUtils.info(TAG, "onFail: " + e.toString());
            }
        });
    }

    /**
     * 获取个人信息
     *
     * @param productitemCode
     */
    private void getMineInfo(String productitemCode) {
        String privateKey = AESUtils.getPrivateKey(24);
        String privateKeyFront = AESUtils.getPrivateKeyFront(privateKey);
        String privateKeyBehind = AESUtils.getPrivateKeyBehind(privateKey);
        LogUtils.info(TAG, "随机秘钥：" + privateKey);
        LogUtils.info(TAG, "随机秘钥19：" + privateKeyFront);
        LogUtils.info(TAG, "随机秘钥5：" + privateKeyBehind);
        BaseApplication.getInstance().setEasyHttpHead(NET_CONSTANT.HEADER_SECRETKEY_NAME, privateKeyFront);
        GetMineInfoApi getMineInfoApi = new GetMineInfoApi().setLanguageCode(NET_CONSTANT.LANGUAGE_CODE)
                .setItemCode(NET_CONSTANT.ITEM_CODE)
                .setSessionId(SPUtil.getString(getContext(), SPConstant.SP_NAME, SPConstant.SP_SESSIONID))
                .setProductItemCode(productitemCode);

        Map<String, Object> stringObjectMap = MapUtils.objectToMap(getMineInfoApi);
        String json = ObjectToJsonUtil.getJson(stringObjectMap);
        LogUtils.info(TAG, json);
        String newJson = ObjectToJsonUtil.getNewJson(stringObjectMap);
        LogUtils.info(TAG, newJson);
        String aesEncrypt = AESUtils.aesEncrypt(newJson, privateKey, NET_CONSTANT.VIPARR);
        LogUtils.info(TAG, "加密： " + aesEncrypt);
        String aesDecrypt = AESUtils.aesDecrypt(aesEncrypt, privateKey, NET_CONSTANT.VIPARR);
        LogUtils.info(TAG, "解密： " + aesDecrypt);
        EasyHttp.post(this).api(new GetMineInfoApi()).body(new JsonBody(aesEncrypt + privateKeyBehind)

        ).request(new OnHttpListener<HttpData<GetMineInfoBean>>() {
            @Override
            public void onStart(Call call) {
                LogUtils.info(TAG, "onStart: ");
            }

            @Override
            public void onSucceed(HttpData<GetMineInfoBean> result, boolean cache) {
                LogUtils.info(TAG, "onSucceed原始: " + result.toString());
                if (DBManager.getInstance(getActivity().getApplicationContext()).queryMineInfoBean() == null) {
                    LogUtils.info(TAG,"需要存储数据");
                    DBManager.getInstance(getActivity().getApplicationContext()).insertUser(result.getData());
                }
            }

            @Override
            public void onEnd(Call call) {
                LogUtils.info(TAG, "onEnd: ");
            }

            @Override
            public void onSucceed(HttpData<GetMineInfoBean> data) {
                LogUtils.info(TAG, "data: " + data);
            }

            @Override
            public void onFail(Exception e) {
                LogUtils.info(TAG, "e: " + e.toString());
            }
        });
    }
}